package unittests;

import org.junit.After;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import spreadsheet.SpreadSheetCell;

/**
 * @author Audrey Paiement
 */
public class SpreadSheetCellTest {
    
	SpreadSheetCell cell;
	String result;

	@Before
	public void setUp() {
		cell = new SpreadSheetCell();
		result = "";
	}

	@After
	public void tearDown() {
		cell = null;
	}

	/**
	 * Test method for {@link spreadsheet.SpreadSheetCell#getCellValue()}.
	 */
	@Test
	public void testGetCellValue() {
		cell.setCellValue("1");
		result = cell.getCellValue();
		assertEquals("1", result);
                
                cell.setCellValue("");
                result = cell.getCellValue();
                assertEquals("", result);
                
                cell.setCellValue( null );
                result = cell.getCellValue();
                assertNull( result );
                
                cell.setCellValue("\n");
                result = cell.getCellValue();
                assertEquals("\n", result);
	}

	/**
	 * Test method for {@link spreadsheet.SpreadSheetCell#getCellType()}.
	 */
	@Test
	public void testGetCellType() {
		cell.setCellType(SpreadSheetCell.CELL_TYPES_FORMULA);
		result = cell.getCellType();
		assertEquals(SpreadSheetCell.CELL_TYPES_FORMULA, result);

		cell.setCellType(SpreadSheetCell.CELL_TYPES_PRIMITIVE);
		result = cell.getCellType();
		assertEquals(SpreadSheetCell.CELL_TYPES_PRIMITIVE, result);
                
                cell.setCellType( "" );
		result = cell.getCellType();
		assertEquals("", result);
                
                cell.setCellType( "george" );
		result = cell.getCellType();
		assertEquals("george", result);
                
                cell.setCellType( null );
		result = cell.getCellType();
		assertEquals(null, result);
	}
}